import {Component} from '@angular/core';
import {App, IonicPage, NavController} from 'ionic-angular';
import {DialogProvider} from "@providers/dialog";
import {StorageProvider} from "@providers/storage";

@IonicPage()
@Component({
  selector: 'page-manager-my',
  templateUrl: 'manager-my.html',
})
export class ManagerMyPage {
  userInfo: any;

  constructor(public navCtrl: NavController,
              private storageService: StorageProvider,
              private dialog: DialogProvider,
              private storage:StorageProvider,
              private app: App,) {
    this.userInfo = this.storageService.read('userInfo');
  }

  ionViewDidLoad() {

  }

  push(page: string, data?: any) {
    this.navCtrl.push(page, data);
  }

  logout() {
    this.dialog.showConfirm(() => {
      this.storage.write("userInfo", {});
      this.app.getRootNav().setRoot('ManagerLoginPage');
    }, "是否退出登录？")
  }
}
